<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动态伪类选择器 focus</title>
    <style>
        input{
            border:1px solid #000;
            outline: none;
        }
        input:focus{
            border:1px solid red;
        }
    </style>
</head>

<body>
    <p>点击文本输入框表单可以看到淡蓝色背景:</p>

    <form>
        用户名: <input type="text" name="firstname" /><br>
        密　码: <input type="text" name="lastname" />
    </form>

</body>

</html>